<?php


class OutController extends EController
{

    public function actionlist() //推荐列表
    {
        $cookie = new CHttpCookie('articlehttpbor', str_replace("/admin/","",$_SERVER["REQUEST_URI"]));
        $cookie->expire = time()+60*60*24*30;
        Yii::app()->request->cookies['articlehttpbor']=$cookie;
        $this->layout='list';
        $this->son_menu=0; //头部的子菜单
        $act_list=ActionMenuHelper::getHiddenMenu();
        $model=new ShopCardOutLog('search');
        $model->unsetAttributes();
        if(isset($_GET['ShopCardOutLog']))
            $model->attributes=$_GET['ShopCardOutLog'];



        $this->render('list',array(
                'dataProvider'=>$model->search(),
                'act_list'=>$act_list,
                'model'=>$model)
        );
    }

    public function actiondownload(){

        $id = $this->_getId();
        $this->layout='list';
        $this->son_menu=1;
        $model = new DownLoadForm();

        if($model->add($id))
        {
            $this->showMessage(Yii::t('info','operation success'),'aiunify/log/list');
        }
        else
        {
            $this->showMessage(Yii::t('info','operation failed'),'aiunify/log/list');
        }


    }



    //获取id
    private function _getId(){
        if(!isset($_GET['id']) || !is_numeric($_GET['id'])){
            throw new CHttpException(400,'Invalid request. id is required!');
        }
        return $_GET['id'];
    }

}